package Test1.Thermometry;

import Test1.HCNetSDK;
import com.sun.jna.Pointer;

/**
 * Created by panting6 on 2021/3/2.
 */
public class ThermometryPresetInfo {
    static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
    public void thermometryPresetInfo(int lUserID, int iChannelNum) {
        boolean bRet = false;
        HCNetSDK.BYTE_ARRAY pstatus = new HCNetSDK.BYTE_ARRAY(16 * 1024);
        Pointer pStatusBuffer = pstatus.getPointer();
        HCNetSDK.NET_DVR_STD_CONFIG m_lpConfigParam = new HCNetSDK.NET_DVR_STD_CONFIG();
        HCNetSDK.NET_DVR_THERMOMETRY_COND m_lpThCond = new HCNetSDK.NET_DVR_THERMOMETRY_COND();
        HCNetSDK.NET_DVR_THERMOMETRY_PRESETINFO m_lpThPresetInfp = new HCNetSDK.NET_DVR_THERMOMETRY_PRESETINFO();
        m_lpThCond.dwSize = m_lpThCond.size();
        m_lpThCond.dwChannel = iChannelNum;
        m_lpThCond.wPresetNo = 1;
        m_lpThCond.write();
        m_lpConfigParam.lpCondBuffer = m_lpThCond.getPointer();
        m_lpConfigParam.dwCondSize = m_lpThCond.dwSize;
        m_lpConfigParam.lpInBuffer = null;
        m_lpConfigParam.dwInSize = 0;
        m_lpConfigParam.lpOutBuffer = m_lpThPresetInfp.getPointer();
        m_lpConfigParam.dwOutSize = m_lpThPresetInfp.size();
        m_lpConfigParam.lpStatusBuffer = pStatusBuffer;
        m_lpConfigParam.dwStatusSize = 16 * 1024;
        m_lpConfigParam.byDataType = 0;
        m_lpConfigParam.write();
        m_lpThPresetInfp.write();
        bRet = hCNetSDK.NET_DVR_GetSTDConfig(lUserID, 3624, m_lpConfigParam);
        if (bRet == false) {
        } else
            m_lpThPresetInfp.read();
        System.out.println("预置点参数获取成功!预置点1：" + m_lpThPresetInfp.wPresetNo + "，使能：" + m_lpThPresetInfp.struPresetInfo[0].byEnabled + ",规则ID：" + m_lpThPresetInfp.struPresetInfo[0].byRuleID
                + ",距离：" + m_lpThPresetInfp.struPresetInfo[0].wDistance + ",发射率：" + m_lpThPresetInfp.struPresetInfo[0].fEmissivity + ",距离单位：" + m_lpThPresetInfp.struPresetInfo[0].byDistanceUnit
                + ",反射温度使能：" + m_lpThPresetInfp.struPresetInfo[0].byReflectiveEnabled + ",反射温度：" + m_lpThPresetInfp.struPresetInfo[0].fReflectiveTemperature + ",规则名称：" + m_lpThPresetInfp.struPresetInfo[0].szRuleName
                + ",规则标定类型：" + m_lpThPresetInfp.struPresetInfo[0].byRuleCalibType + ",点测温坐标：（" + m_lpThPresetInfp.struPresetInfo[0].struPoint.fX + "," + m_lpThPresetInfp.struPresetInfo[0].struPoint.fY + ")"
        );
    }
}
